﻿using Microsoft.EntityFrameworkCore;
using Reader.Core.DataAccessObject;
using Reader.Core.DataAccessObject.Models;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Reader.Core.Application
{
    public class Sites
    {
        public async Task<Result<List<BookSite>>> GetSites()
        {
            using var db = new ApplicationDBContext();
            var sites = await db.BookSites
                .Where(s => s.Speed != 0)
                .OrderBy(s => s.Speed)
                .ToListAsync();
            return ResultStatus<List<BookSite>>.Success(sites);
        }
    }
}
